<template>
	<view>

		<view class="" style="margin: 10px;">


			<view class=""
				style="display: flex;flex-direction: row;justify-content: center;margin-bottom: 20px;margin-top: 50px;">
				<image src="../../static/review.gif" mode="" style="width: 200px;height: 200px;"></image>
			</view>

			<view class="" style="display: flex;flex-direction: row;justify-content: center;margin-bottom: 20px;">
				<text style="color: #333333;font-size: 24px; font-weight: 500;">资质审核中</text>
			</view>


			<view class="" :animation="animationData">
				<text style="margin-left: 25px;color: #4A5DFF;font-size: 13px;font-weight: 500;">{{progress}}%</text>
			</view>
			<progress percent="100" stroke-width="8" active="true" border-radius='6px' backgroundColor='#DDDFF1'
				activeColor="#4A5DFF" duration='45' style="margin-left: 35px;margin-right: 35px;" />

			<view class="" style="display: flex;flex-direction: row;justify-content: center;margin-top: 18px;">
				<text style="color: #333333;font-size: 13px;">{{title}}</text>
			</view>





			<view class="" style="display: flex;flex-direction: column;margin-top: 50px;">

				<view class=""
					style="display: flex;flex-direction: row;align-items: center;justify-content: center;padding-right: 20px;margin-top: 22px;">
					<cc-loading color="#0081ff" v-show="hidden1" size='10'></cc-loading>
					<image src="../../static/reviewfinish.png" mode="" style="width: 18px;height: 18px;"
						v-show="!hidden1">
					</image>
					<text style="font-size: 15px;color: #4A5DFF; margin-left: 12px;">资金智能匹配</text>
				</view>



				<view class=""
					style="display: flex;flex-direction: row;align-items: center;justify-content: center;padding-right: 20px;margin-top: 22px;">

					<cc-loading color="#0081ff" v-show="hidden2" size='10'></cc-loading>
					<image src="../../static/reviewfinish.png" mode="" style="width: 18px;height: 18px;"
						v-show="!hidden2">
					</image>
					<text style="font-size: 15px;color: #4A5DFF; margin-left: 12px;">申请资料评估</text>
				</view>




				<view class=""
					style="display: flex;flex-direction: row;align-items: center;justify-content: center;padding-right: 20px;margin-top: 22px;">
					<cc-loading color="#0081ff" v-show="hidden3" size='10'></cc-loading>
					<image src="../../static/reviewfinish.png" mode="" style="width: 18px;height: 18px;"
						v-show="!hidden3">
					</image>
					<text style="font-size: 15px;color: #4A5DFF; margin-left: 12px;">借款风险评估</text>
				</view>

			</view>







		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				time: null,
				hidden1: true,
				hidden2: true,
				hidden3: true,
				progress: 0,
				animationData: {},
				ktxWindowWidth: '',
				title: '资金智能匹配'

			}
		},
		onUnload() {
			
		
			this.animationData = {}
			
			
		
		},

		onLoad() {
			this.city()
			this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight

			let systemInfo = uni.getSystemInfoSync()


			this.ktxWindowWidth = systemInfo.windowWidth
			
		


			this.animation = uni.createAnimation()
			this.time = setTimeout(() => {
				this.hidden1 = false
				this.title = '申请资料评估'

			}, 1500)
			this.time = setTimeout(() => {
				this.hidden2 = false
				this.title = '借款风险评估'

			}, 3000)
			this.time = setTimeout((e) => {
				this.hidden3 = false
				this.title = '评估完成'
				var s = uni.getStorageSync('pageType')

				if (s == 'h5_auth_list') {
					// uni.redirectTo({
					// 	url: '../home/home'
					// })
					window.open('\\approve/#/prodList', "_top")
				} else if (s == 'h5_auth_download') {
					let platform = uni.getSystemInfoSync().platform;
					if(platform == 'ios') {
						// uni.redirectTo({
						// 	url: '../home/home'
						// })
						window.open('\\approve/#/prodList', "_top")
					}else {
						uni.redirectTo({
							url: '../download/download'
						})
						
					}
				
				}else if (s == 'h5_auth') {
					uni.redirectTo({
						url: '../testdown/testdown'
					})
				}  else {
					// uni.redirectTo({
					// 	url: '../home/home'
					// })
					window.open('\\approve/#/prodList', "_top")
				}



			}, 4500)
			this.timer = setInterval((e) => {
				//TODO 
				this.progress++
				// console.log(e)
				if (this.progress > 99) {
					clearInterval(this.timer);

				}

			}, 45);
			this.running()
		},
		methods: {
			translate: function() {
				this.animation.translate(Math.random() * 100 - 50, Math.random() * 100 - 50).step()
				this.animationData = this.animation.export()
			},
			running() {
				this.animation.translateX(this.ktxWindowWidth - 70 - 25).step({
					duration: 4500
				})
				// 调用实例的方法来描述动画,translateX定义动画类型为x轴偏移, 500为偏移长度, 单位px
				// 调用 step() 来表示一组动画完成(当前参数动画时间1s)
				// step 可以配置参数用于指定当前组动画的配置。具体参数请看文档
				this.animationData = this.animation.export()
				// export方法导出动画数据
			},
			async city () {
				const res = await this.$myRequest({
					url: 'api/sys/getipinfo',
					method: 'post',
					data: {
				
					}
				});
				console.log(res.provinceCode)
				if (res.provinceCode == 110000 || res.provinceCode == 310000) {
					uni.setStorageSync('pageType', 'h5_auth')
					uni.setStorageSync('fasthome', false)
				
				} else {
					uni.setStorageSync('fasthome', true)
				}
				
				
			}




		}
	}
</script>

<style>
	/deep/ .uni-progress-bar {
		border-radius: 6px;
	}

	/deep/.uni-progress-inner-bar {
		border-radius: 6px;
	}
</style>
